<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var body = document.body;
        body.innerHTML = '<div>div.add</div> <button>查询</button>';
        var div = document.querySelector('div');
        var btn = document.querySelector('button');
        div.style.width = 300 + 'px';
        div.style.height = 300 + 'px';
        div.style.borderRadius = 150 + 'px';
        div.style.borderWidth = 5 + 'px';
        div.style.borderStyle = 'solid';
        div.style.borderColor = 'red';
        btn.style.width = 50 + 'px';
        btn.style.height = 30 + 'px';
        // div.style.backgroundColor = 'rgb(255, 0, 0)';
        btn.onclick = function() {
            var sum = random(0, 255);
            var sum1 = random(0, 255);
            var sum2 = random(0, 255)
            var rgb = 'rgb('+ sum +','+ sum1 + ',' + sum2 + ')';
            console.log(rgb);
            div.style.backgroundColor = rgb;
        }
        function random(min, max) {
            return Math.floor(Math.random() * (max - min)) + min;
        }
        for (var i = 1; i <= 10; i++) {
            console.log(random(0, 225));
        }
    </script>
</body>
</html>